package cn.cloud.all.security.oauth2.provider.implicit;


import cn.cloud.all.security.oauth2.provider.OAuth2Request;
import cn.cloud.all.security.oauth2.provider.TokenRequest;

import java.util.concurrent.ConcurrentHashMap;

/**
 * In-memory implementation of the ImplicitGrantService.
 */
@SuppressWarnings("deprecation")
public class InMemoryImplicitGrantService implements ImplicitGrantService {

    protected final ConcurrentHashMap<TokenRequest, OAuth2Request> requestStore = new ConcurrentHashMap<TokenRequest, OAuth2Request>();

    public void store(OAuth2Request originalRequest, TokenRequest tokenRequest) {
        this.requestStore.put(tokenRequest, originalRequest);
    }

    public OAuth2Request remove(TokenRequest tokenRequest) {
        return this.requestStore.remove(tokenRequest);
    }
}
